/*
 * @Description:
 * @version:
 * @Author: sunqian_sr
 * @Date: 2023-01-16 20:29:41
 * @LastEditors: Andy
 * @LastEditTime: 2023-01-16 20:40:20
 */
import { Http } from '@/common/api'

export const listUrl = '/upms/user/page'

// 用户管理
export const userApi = {}
/**
 * 查询用户列表
 * @param params
 * @return {*|Promise}
 */
export const apiPostUserList = async (params) => Http.post(listUrl, params)
/**
 * 新增用户
 * @param params
 * @return {*|Promise}
 */
export const apiPostAddUserBase = async (params) => Http.post('/upms/user/add', params)
/**
 * 编辑用户
 * @param params
 * @return {*|Promise}
 */
export const apiPostEditUserBase = async (params) => Http.put('/upms/user/update', params)
/**
 * 根据ID获取用户详情
 * @param id
 * @return {*|Promise}
 */
export const apiGetUserInfo = async (id) => Http.get(`/upms/user/findById/${id}`)
/**
 * 根据ID删除用户
 * @param ids
 * @return {*|Promise}
 */
export const apiDeleteUser = async (ids) => Http.delete(`/upms/user/batch/delete/${ids}`)
/**
 * 重置用户密码
 * @param params
 * @return {*|Promise}
 */
export const apiPostResetPwd = async (params) => Http.put('/upms/user/resetPwd', params)

/**
 * 批量启用用户
 * @param params
 * @return {*|Promise}
 */
export const apiPutbatchUserEnble = async (params) => Http.put('/upms/user/batch/enable', params)

/**
 * 批量禁用用户
 * @param params
 * @return {*|Promise}
 */
export const apiPostbatchUserDisable = async (params) => Http.put('/upms/user/batch/disable', params)

/**
 * 用户岗位绑定
 * @param params
 * @return {*|Promise}
 */
export const apiPostUserPost = async (params) => Http.post('/upms/user/post/batch/add', params)

/**
 * 用户角色绑定
 * @param params
 * @return {*|Promise}
 */
export const apiPostUserRoles = async (params) => Http.post('/upms/user/role/batch/add', params)

/**
 * 用户头像修改
 * @param params
 * @return {*|Promise}
 */
export const apiPutUserAvatar = async (params) => Http.put('/upms/user/uploadAvatar', params)

export const userExportUrl = '/upms/user/exportExcel'

export const userRoleExportUrl = '/upms/role/exportExcel'

// 供应商列表
export const listSupplierUrl = '/upms/user/page'

// 获取组织机构
export const apiDeptTree = async (params) => Http.post('/upms/dept/tree', params)

// 组织机构下用户列表
export const listOrgUserUrl = '/upms/user/pageUserByOrg'

// 获取税率下拉
export const apiTaxRateList = async () => Http.post('/srm/taxRate/page', { pageNum: 1, pageSize: 200, data: {} })
// 获取采购组织下拉
export const apiPurchaseOrgList = async () =>
  Http.post('/srm/purchase/org/page', { pageNum: 1, pageSize: 200, data: {} })
// 获取采购组下拉
export const apiPurchaseTeamList = async () =>
  Http.post('/srm/purchase/team/page', { pageNum: 1, pageSize: 200, data: {} })
// 获取收货仓库下拉
export const apiReceiveStoreList = async () =>
  Http.post('/srm/warehouse/addr/page', { pageNum: 1, pageSize: 200, data: {} })
